import { DomAdapter } from "splittings-dom/dist/es/splittings-dom";
import { Slot, Workspaces } from "splittings/dist/es/splittings";

export class MyDomAdapter extends DomAdapter {
  line_size(): number {
    return 5;
  }
  workspaces_rect(ws: Workspaces) {
    const r = this.container.getBoundingClientRect();
    return { x: 0, y: 0, w: r.width + 1, h: r.height + 1 };
  }
  slot_update(slot: Slot): void {
    const element = this.get_cell(slot);
    if (!element)
      return;
    element.style.left = '' + slot.rect.x + 'px';
    element.style.top = '' + slot.rect.y + 'px';
    element.style.width = '' + (slot.rect.w + 1) + 'px';
    element.style.height = '' + (slot.rect.h + 1) + 'px';
    element.style.zIndex = this.slot_z_index(slot);
  }
  // slot_create(slot: Slot): void {
  //   super.slot_create(slot)
  //   const element = this.get_cell(slot);
  //   if (!element) return;
  //   element.addEventListener('click', () => this.on_slot_press?.(slot))
  // }
  slot_release(slot: Slot): void {
    super.slot_release(slot)
  }
}
